#include <io.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* known sector types */
#define MODE_0	0
#define MODE_1	1
#define MODE_2	2
#define MODE_2_FORM_1	3
#define MODE_2_FORM_2	4

#define RS_L12_BITS 8

/* audio sector definitions for CIRC */
#define FRAMES_PER_SECTOR 98
/* user data bytes per frame */
#define L1_RAW 24
/* parity bytes with 8 bit */
#define L1_Q   4
#define L1_P   4

/* data sector definitions for RSPC */
/* user data bytes per frame */
#define L2_RAW (1024*2)
/* parity bytes for 16 bit units */
#define L2_Q   (26*2*2)
#define L2_P   (43*2*2)

/* Layer 2 Product code en/decoder */
int do_encode_L2(unsigned char inout[(12 + 4 + L2_RAW+4+8+L2_Q+L2_P)], int sectortype, unsigned address);